home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS11.ADF
/
Progs
/
PS.CPri.DOC
< prev
next >
Wrap
Text File
|
1986-08-05
|
3KB
|
84 lines
/*
Here's a belated contribution to the discussion on process priorities.
cpri uses the Exec SetTaskPri function to fiddle around with the process
priorities of running CLI processes.
I've also thrown in a "ps" command, as a replacement for "status". I've
no idea why status displays all those question marks - ps gives you the
command name instead.
This posting contains the following items:
ps+cpri.doc a readme file
ps.c source for the ps command
cpri.c source for the cpri command
ps.Z.b the executable, run through compress and btoa
cpri.Z.b the executable, run through compress and btoa
To regenerate the executables, run them through atob and then uncompress (or
compress -d). atob, btoa and compress are part of the mod.sources
distribution.
------------------------------ cut here ----------------------------------
echo "creating source files:"
echo "\tps+cpri.doc"
cat <<"FUNKYSTUFF" >ps+cpri.doc
Documentation for the ps and cpri commands
------------------------------------------
ps and cpri are commands that allow you to investigate and change the
priorities of running AmigaDOS processes. In addition, ps can be viewed
as a replacement for the "status" command.
syntax
------
cpri priority CLI-process-number
ps [-f]
Priorities run in the range -128 to 127.
The CLI-process-number is that reported by the status and ps commands, and
has values between 1 and 20.
Note that only AmigaDOS user processes can have their priority changed --
you can't fiddle around with the priority of filesystem tasks, for
instance. In general, this works for processes, not tasks.
using cpri
----------
You have to take a certain amount of care in the use of this command. cpri'ing
a cpu-bound process to a priority greater than zero will lock up your machine
until it completes.
In order to experiment with this command, you can do the following:
1. Create and compile cpuhog.c, which has the following contents:
main() { for(;;) Chk_Abort(); }
2. Run nine or ten cpuhogs in background. They'll be running at
priority -5.
3. See how the responsiveness of the initial CLI degrades as you
start cpri'ing each cpuhog command to priority 0.
4. To get rid of a cpuhog, use the break command:
break CLI-process-number
5. If you *really* must, set the priority of a cpuhog to a +ve value.
Congratulations. You'll have to reboot, because your initial CLI
won't get any CPU until cpuhog completes or waits -- and it never
will!
suggested uses
--------------
You can prioritize background tasks. If two or more are running, temporarily
lowering the priority of some will allow the others to complete faster.
ps
--
A replacement command for status, called "ps", is part of this package. I
wrote it because I didn't like the way that status kept reporting most of
my CLI commands as "????????". I assume that's a bug in status, but it may
be a feature...
ps will report command names and process numbers. If given a "-f" command line
flag, CLI type and process priority is also reported.
bugs
----
cpri should really be folded into run. Sort of like the UNIX nice command.